<?php
defined('OA_LIB_PATH') || define('OA_LIB_PATH', '/opt/op/OALib');
defined('OPEN_LIB_PATH') || define('OPEN_LIB_PATH', '/opt/op/OpenLib');

require_once 'PHPUnit/Framework.php';
require_once 'Log.php';
require_once OPEN_LIB_PATH . '/open/business-logic/OaAppServerLogic.php';
require_once OPEN_LIB_PATH . '/open/business-logic/OaSyncInfoLogic.php';

class OaAppServerLogicTest extends PHPUnit_Framework_TestCase
{
    private $_logger;
    
    protected function setUp()
    {
        $logger = Log::factory('console', '', '', array(
    		'lineFormat' => '[%1$s] [%3$s] %5$s(%6$s): %4$s',
    		'timeFormat' => '%Y-%m-%d %H:%M:%S'
        ), PEAR_LOG_INFO);
        $this->_logger = $logger;
    }
    
    protected function tearDown()
    {
        
    }
    
    /**
     * @dataProvider appProvider
     */
    public function testGetGSChanges($appId)
    {
        $this->markTestSkipped();
        $result = OaAppServerLogic::getGSChanges($appId, OaAppModel::APP_CONFIG_ENV_PRODUCTION);
        $this->_logger->info($result);
        $this->assertTrue($result !== false);
    }
    
    /**
     * @dataProvider appProvider
     */
    public function testGetLSChanges($appId)
    {
        $this->markTestSkipped();
        $result = OaAppServerLogic::getLSChanges($appId, OaAppModel::APP_CONFIG_ENV_PRODUCTION);
        $this->_logger->info($result);
        $this->assertTrue($result !== false);
    }
    
    /**
     * @dataProvider appProvider
     */
    public function testGetPSChanges($appId)
    {
        $this->markTestSkipped();
        $result = OaAppServerLogic::getPSChanges($appId, OaAppModel::APP_CONFIG_ENV_PRODUCTION);
        $this->_logger->info($result);
        $this->assertTrue($result !== false);
    }
    
    /**
     * @dataProvider appProvider
     */
    public function testRevertChanges($appId)
    {
//        $this->markTestSkipped();
        $result = OaAppServerLogic::revertChanges($appId, OaAppModel::APP_CONFIG_ENV_PRODUCTION);
        $this->_logger->info($result);
        $this->assertTrue($result !== false);
    }
    
    public function appProvider()
    {
        return array(
            array(110091800)
        );
    }
}
